<?php

namespace app\admin\model\elevator;

use think\Model;


class Maintenance extends Model
{

    

    

    // 表名
    protected $name = 'elevator_maintenance';
    
    // 自动写入时间戳字段
    protected $autoWriteTimestamp = false;

    // 定义时间戳字段名
    protected $createTime = false;
    protected $updateTime = false;
    protected $deleteTime = false;

    // 追加属性
    protected $append = [
        'maintenance_cycle_text'
    ];
    

    
    public function getMaintenanceCycleList()
    {
        return ['半月' => __('半月'), '季度' => __('季度'), '半年' => __('半年'), '年度' => __('年度')];
    }


    public function getMaintenanceCycleTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['maintenance_cycle']) ? $data['maintenance_cycle'] : '');
        $list = $this->getMaintenanceCycleList();
        return isset($list[$value]) ? $list[$value] : '';
    }




}
